package SortAlgorithm;

import java.util.Arrays;

public class ShellSort2 {
    public static void main(String[] args) {
        int[] a=new int[]{90 ,61 ,94 ,62 ,13 ,50, 9 ,52 ,73 ,75};
        System.out.println(Arrays.toString(a));
        shellSort(a);
        System.out.println(Arrays.toString(a));
    }
    public static void shellSort(int[] array){
        for(int interval=array.length/2;interval>0;interval/=2){
            for(int i=interval;i<array.length;i++){
                int target=array[i];
                int j=i-interval;
                while(j>-1&&target>array[j]){
                    array[j+interval]=array[j];
                    j-=interval;
                }
                array[j+interval]=target;
            }
        }
    }
}
